<form id="adduser-form" lay-filter="adduser-form" class="layui-form model-form fromzby">
	<input name="userId" type="hidden" />
	<div class="layui-row layui-col-space20">
		<div class="layui-col-xs12 layui-col-md12">
			选择医生
			<hr class="layui-bg-green">
			<ul id="yss">
			</ul>
		</div>
	</div>

	<div class="layui-form-item model-form-footer">
		<button class="layui-btn layui-btn-primary" ew-event="closeDialog" type="button">取消</button>
		<button class="layui-btn" lay-filter="adduser-form-submit" lay-submit>保存</button>
	</div>
</form>
<script>
	layui.use(['layer', 'admin', 'form', 'formSelects', 'config'], function() {
		var layer = layui.layer;
		var admin = layui.admin;
		var form = layui.form;
		var formSelects = layui.formSelects;
		var config = layui.config;
		var alog = config.getTempData('loginInfo');

		var ys = admin.getTempData("ysus");
		sb()
		if(ys) {
			form.val('adduser-form', ys);
			$('#adduser-form').attr('method', 'GET');
		}

		function sb() {
			var a
			$.ajax({
				type: "POST",
				url: getCustomer,
				data: {
					params: JSON.stringify({})
				},
				dataType: "json",
				xhrFields: {
					withCredentials: true
				},
				beforeSend: function(request) {},
				success: function(data) {
					console.log(data)
					if(data.length > 0) {
						for(var i = 0; i < data.length; i++) {
							$("#yss").append('<li><input type="radio" name="customerServiceId" value="' + data[i].customerServiceId + '" title="' + data[i].name + '" /></li>');
						}
					}
					form.render('radio');
				},
				error: function(result) {
					console.log(result);
				},
			});
		}

		// 表单提交事件
		form.on('submit(adduser-form-submit)', function(data) {
			console.log(data)

			$.ajax({
				type: "POST",
				url: updatarank,
				data: {
					params: JSON.stringify(data.field)
				},
				dataType: "json",
				xhrFields: {
					withCredentials: true
				},
				success: function(data) {
					layer.msg(data.msg, {
						icon: 1
					});
					admin.finishPopupCenter();
				},
				error: function(result) {
					console.log(result);
				},
			});
			return false;
		});

	});
</script>